export default{
  getLineChart(xData, data) {
    let option = {
      tooltip: {
        trigger: 'axis',
      },
      toolbox: {
        show: true,
        feature: {
          saveAsImage: {}
        }
      },
      xAxis: {
        type: 'category',
        data: xData
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          data: data,
          type: 'line',
          itemStyle: {
            color: '#53B8F2'
          }
        }
      ]
    }
    return option
  },
  getPieChart(data) {
    let option = {
      tooltip: {
        trigger: 'item'
      },
      toolbox: {
        show: true,
        feature: {
          saveAsImage: {}
        }
      },
      legend: {
        orient: 'vertical',
        top: '20%',
        left: '15%',
        icon: 'rect',
        itemHeight: 10,
        itemWidth: 10,
        itemGap: 15,
      },
      series: [
        {
          type: 'pie',
          radius: '50%',
          label: {
            show: true,
            formatter: '{b}\n{d}%'
          },
          emphasis: {
            label: {
              fontSize: '14'
            }
          },
          data: data
        }
      ]
    }
    return option
  },
  getBarChart(xData, data) {
    let option = {
      legend: {},
      tooltip: {},
      toolbox: {
        show: true,
        feature: {
          saveAsImage: {}
        }
      },
      xAxis: {
        type: 'category',
        data: xData,
      },
      yAxis: {},
      series: [
        {
          data: data,
          type: 'bar',
          barWidth: 24,
          itemStyle: {
            color: '#53B8F2'
          }
        }
      ]
    }
    return option
  }
}
  /* 
  // 二维
  getLineChart(legendData, xData, seriesData) {
    let option = {
      tooltip: {
        trigger: 'axis',
      },
      legend: {
        data: legendData
      },
      grid: {
        // top: '1%',
        left: '3%',
        right: '3%',
        bottom: '6%',
        containLabel: true
      },
      xAxis: {
        type: 'category',
        boundaryGap: false,
        data: xData
      },
      yAxis: {
        type: 'value'   
      },
      series: seriesData
    }
    return option
  },
  getBarChart(data) {
    let option = {
      legend: {},
      tooltip: {},
      dataset: {
        source: data,
      },
      xAxis: { type: 'category' },
      yAxis: {},
      series: [
        {
          type: 'bar'
        },
        {
          type: 'bar'
        },
        {
          type: 'bar'
        },
      ]
    }
    return option
  }, */